//
//  BlackNameClass.m
//  YaoHeAPP
//
//  Created by mac on 16/1/2.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "BlackNameClass.h"

@implementation BlackNameClass

-(id)initWith:(NSDictionary*)dic
{
    self=[super init];
    
    if (self) {
        self.companyID=dic[@"COMPANY_ID"];
        self.companyName=dic[@"COMPANY_NAME"];
        self.logoPath=[self withDic:dic Key:@"LOGO_PATH"];
        self.creditScore=[self withDic:dic Key:@"CREDIT_SCORE"];
        self.quoteNum=[self forKey:@"QUOTE_NUM" inDictionary:dic];
        self.successNum=[self forKey:@"SUCCESS_NUM" inDictionary:dic];
    }
    return self;
}


//用此方法可以防止服务器更换数据程序崩掉
-(NSString*)forKey:(NSString*)key inDictionary:(NSDictionary*)dic
{
    NSString*string;
    if ([[dic allKeys]containsObject:key]) {
        string=dic[key];
    }
    else{
        string=@"";
    }
    return string;
}

-(NSString*)withDic:(NSDictionary*)dic Key:(NSString*)key
{
    NSString*string;
    if ([[dic allKeys]containsObject:key]) {
        string=dic[key];
    }
    else{
       string=@"";
    }
    return string;
}



@end
